import { AdminRecord } from "src/views/admin/AdminType";
import { getSource } from "./common";
import { PipelineStage } from "mongoose";

type GetAdminRequest = {
	page?: number;
	pageSize?: number;
	lookup?: PipelineStage.Lookup['$lookup'];
} & Record<string, unknown> &
	Partial<
		| AdminRecord
		| Record<keyof AdminRecord, { like: boolean; value: unknown }>
	>;
export const getAdmin = async (params: GetAdminRequest) => {
	const reqParams = {
		source: "admin",
		...params,
	};

	return await getSource<{ total: number; data: AdminRecord[] }>(reqParams);
};
